class Validateable(object):
	"""
	A class that can be used as a mixin to run validation code
	and keep track of instance errors.
	"""
	
	def __init__(self):
		self._errors = None
	
	@property
	def errors(self):
		if self._errors is None:
			self._errors = self.validate()
		return self._errors
		
	def is_valid(self):
		return len(self.errors) == 0
		
	def validate(self):
	    raise NotImplementedError, u'%s does not define a "validate()" function.' % type(self).__name__